// Copyright 2017 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------
// Modification history:
// feature: support e2e deadline and liveliness: 1. xml support e2e_deadline and e2e_liveliness config 2. data writer and data reader support e2e deadline and e2e liveliness qos
// feature: add multi-domain support for discovery server
// feature: suport super-client
// feature: modify log level
// feature: log period config supported by xml
// feature: implement IPC transport
// ------------------------------------------------------------------

#ifndef XMLPARSER_XMLPARSERCOMMON_H_
#define XMLPARSER_XMLPARSERCOMMON_H_

namespace vbsutil {
namespace xmlparser {

/**
 * Enum class XMLP_ret, used to provide a strongly typed result from the operations within this
 * module.
 * @ingroup XMLPARSER_MODULE
 */
enum class XMLP_ret { XML_ERROR, XML_OK, XML_NOK };

class xmlString {
 public:
    static const char* SHM_SAMPLE_DESCRIPTOR;
    static const char* QUEUE_WAKE_UP_MODE;
    static const char* QUEUE_SIZE;
    static const char* DEFAULT_ERTPS_ENV_VARIABLE;
    static const char* DEFAULT_ERTPS_PROFILES;
    static const char* DEFAULT_STATISTICS_DATAWRITER_PROFILE;
    static const char* SKIP_DEFAULT_XML_FILE;

    static const char* VBS;
    static const char* AGENT;
    static const char* RPC;
    static const char* DDS;
    static const char* PROFILES;
    static const char* BASEXML;
    static const char* LIBRARY_SETTINGS;
    static const char* TRANSPORT_DESCRIPTORS;
    static const char* PROFILE_NAME;
    static const char* DEFAULT_PROF;
    static const char* BASE_NAME;
    static const char* PARTICIPANT;
    static const char* PUBLISHER;
    static const char* SUBSCRIBER;
    static const char* RTPS;
    static const char* TYPES;
    static const char* LOG;
    static const char* ALLOWED_TOPIC;
    static const char* SECURITY;

    static const char* TRANSPORT_DESCRIPTOR;
    static const char* TRANSPORT_ID;
    static const char* UDP_OUTPUT_PORT;
    static const char* UDP_SOCKET_TYPE;
    static const char* XDP_RX_QUEUE_NUM;
    static const char* TCP_WAN_ADDR;
    static const char* RECEIVE_BUFFER_SIZE;
    static const char* SEND_BUFFER_SIZE;
    static const char* TTL;
    static const char* NON_BLOCKING_SEND;
    static const char* WHITE_LIST;
    static const char* MAX_MESSAGE_SIZE;
    static const char* MAX_INITIAL_PEERS_RANGE;
    static const char* KEEP_ALIVE_FREQUENCY;
    static const char* KEEP_ALIVE_TIMEOUT;
    static const char* MAX_LOGICAL_PORT;
    static const char* LOGICAL_PORT_RANGE;
    static const char* LOGICAL_PORT_INCREMENT;
    static const char* ENABLE_TCP_NODELAY;
    static const char* METADATA_LOGICAL_PORT;
    static const char* LISTENING_PORTS;
    static const char* CALCULATE_CRC;
    static const char* CHECK_CRC;
    static const char* SEGMENT_SIZE;
    static const char* PORT_QUEUE_CAPACITY;
    static const char* PORT_OVERFLOW_POLICY;
    static const char* SEGMENT_OVERFLOW_POLICY;
    static const char* HEALTHY_CHECK_TIMEOUT_MS;
    static const char* DISCARD;
    static const char* FAIL;
    static const char* RTPS_DUMP_FILE;
    static const char* ON;

    // IntraprocessDeliveryType
    static const char* OFF;
    static const char* USER_DATA_ONLY;
    static const char* FULL;

    static const char* QOS_PROFILE;
    static const char* APPLICATION;
    static const char* TYPE;
    // static const char* TOPIC;
    static const char* DATA_WRITER;
    static const char* DATA_READER;

    /// LibrarySettings attributes
    static const char* INTRAPROCESS_DELIVERY;

    /// RTPS Participant attributes
    static const char* ALLOCATION;
    static const char* PREFIX;
    static const char* DEF_UNI_LOC_LIST;
    static const char* DEF_EXT_UNI_LOC_LIST;
    static const char* DEF_MULTI_LOC_LIST;
    static const char* SEND_SOCK_BUF_SIZE;
    static const char* LIST_SOCK_BUF_SIZE;
    static const char* BUILTIN;
    static const char* PORT;
    static const char* PORTS;
    static const char* LOGICAL_PORT;
    static const char* PHYSICAL_PORT;
    // static const char* USER_DATA;
    static const char* PART_ID;
    // static const char* IP4_TO_SEND;
    // static const char* IP6_TO_SEND;
    // static const char* THROUGHPUT_CONT;
    static const char* USER_TRANS;
    static const char* USE_BUILTIN_TRANS;
    static const char* TRANSPORT_TYPE;
    static const char* PROPERTIES_POLICY;
    static const char* FLOW_CONTROLLER;
    static const char* FLOW_CONTROL_DESCRIPTOR;
    static const char* NAME;
    static const char* SAVEMODE;
    static const char* REMOTE_LOCATORS;
    static const char* MAX_UNICAST_LOCATORS;
    static const char* MAX_MULTICAST_LOCATORS;
    static const char* TOTAL_PARTICIPANTS;
    static const char* TOTAL_READERS;
    static const char* TOTAL_WRITERS;
    static const char* SEND_BUFFERS;
    static const char* PREALLOCATED_NUMBER;
    static const char* DYNAMIC_LC;
    static const char* MAX_PROPERTIES;
    static const char* MAX_USER_DATA;
    static const char* MAX_PARTITIONS;

    /// Publisher-subscriber attributes
    static const char* TOPIC;
    static const char* QOS;
    static const char* TIMES;
    static const char* EXT_UNI_LOC_LIST;
    static const char* UNI_LOC_LIST;
    static const char* MULTI_LOC_LIST;
    static const char* REM_LOC_LIST;
    static const char* HIST_MEM_POLICY;
    // static const char* PROPERTIES_POLICY;
    static const char* USER_DEF_ID;
    static const char* ENTITY_ID;
    static const char* MATCHED_SUBSCRIBERS_ALLOCATION;
    static const char* MATCHED_PUBLISHERS_ALLOCATION;

    ///
    static const char* IGN_NON_MATCHING_LOCS;
    static const char* PROPERTIES;
    static const char* BIN_PROPERTIES;
    static const char* PROPERTY;
    static const char* VALUE;
    static const char* PROPAGATE;
    static const char* PREALLOCATED;
    static const char* PREALLOCATED_WITH_REALLOC;
    static const char* DYNAMIC;
    static const char* DYNAMIC_REUSABLE;
    static const char* AUTOMATIC_MEMORY;
    static const char* LOCATOR;
    static const char* UDPv4_LOCATOR;
    static const char* UDPv6_LOCATOR;
    static const char* TCPv4_LOCATOR;
    static const char* TCPv6_LOCATOR;
    static const char* UDS_LOCATOR;
    static const char* KIND;
    static const char* ADDRESS;
    static const char* ORDER;
    static const char* WHITE_LIST_ADDRESS;
    static const char* UNIQUE_LAN_ID;
    static const char* WAN_ADDRESS;
    static const char* RESERVED;
    static const char* UDPv4;
    static const char* UDPv6;
    static const char* TCPv4;
    static const char* TCPv6;
    static const char* SHM;
    static const char* SHARED_SHM_QUEUE;
    static const char* IPC;
    static const char* TRANSPORT_TYPE_UDP;
    static const char* TRANSPORT_TYPE_ALL;
    static const char* TRANSPORT_TYPE_AUTO;
    static const char* INIT_ACKNACK_DELAY;
    static const char* HEARTB_RESP_DELAY;
    static const char* INIT_HEARTB_DELAY;
    static const char* HEARTB_PERIOD;
    static const char* NACK_RESP_DELAY;
    static const char* NACK_SUPRESSION;
    static const char* BY_NAME;
    static const char* BY_VAL;
    static const char* DURATION_INFINITY;
    static const char* DURATION_INFINITE_SEC;
    static const char* DURATION_INFINITE_NSEC;
    static const char* SECONDS;
    static const char* NANOSECONDS;
    static const char* SHARED;
    static const char* EXCLUSIVE;
    static const char* FAST_HEARTB_PERIOD;

    /// QOS
    static const char* DURABILITY;
    static const char* DEADLINE;
    static const char* LIVELINESS;
    static const char* RELIABILITY;
    static const char* LIFESPAN;
    static const char* OWNERSHIP;
    static const char* OWNERSHIP_STRENGTH;
    static const char* PARTITION;
    static const char* PUB_MODE;
    static const char* BATCH;
    static const char* ENABLE;
    static const char* MAX_DATA_BYTES;
    static const char* MAX_FLUSH_DELAY;
    static const char* DISABLE_POSITIVE_ACKS;
    static const char* DISABLE_HEARTBEAT_PIGGYBACK;
    static const char* HEARTBEAT_PER_MAX_SAMPLE;
    static const char* HIGH_WATERMARK;
    static const char* LOW_WATERMARK;

    static const char* SYNCHRONOUS;
    static const char* ASYNCHRONOUS;
    static const char* FLOW_CONTROLLER_NAME;
    static const char* NAMES;
    static const char* INSTANCE;
    static const char* GROUP;
    static const char* COHERENT_ACCESS;
    static const char* ORDERED_ACCESS;
    static const char* BY_RECEPTION_TIMESTAMP;
    static const char* BY_SOURCE_TIMESTAMP;
    static const char* MIN_SEPARATION;
    static const char* DURATION;
    static const char* MAX_BLOCK_TIME;
    static const char* _BEST_EFFORT;
    static const char* _RELIABLE;
    static const char* AUTOMATIC;
    static const char* MANUAL_BY_PARTICIPANT;
    static const char* MANUAL_BY_TOPIC;
    static const char* LEASE_DURATION;
    static const char* ANNOUNCE_PERIOD;
    static const char* COUNT;
    static const char* PERIOD;
    static const char* SRV_CLEAN_DELAY;
    static const char* HISTORY_KIND;
    static const char* HISTORY_DEPTH;
    static const char* MAX_SAMPLES;
    static const char* MAX_INSTANCES;
    static const char* MAX_SAMPLES_INSTANCE;
    static const char* ALLOCATED_SAMPLES;
    static const char* EXTRA_SAMPLES;
    static const char* _VOLATILE;
    static const char* _TRANSIENT_LOCAL;
    static const char* _TRANSIENT;
    static const char* _PERSISTENT;
    static const char* KEEP_LAST;
    static const char* KEEP_ALL;
    static const char* _NO_KEY;
    static const char* _WITH_KEY;
    static const char* DATA_TYPE;
    static const char* SEND_MULTI;
    static const char* HISTORY_QOS;
    static const char* RES_LIMITS_QOS;
    static const char* DEPTH;
    static const char* SCHEDULE_MODE;
    static const char* BYTES_PER_SECOND;
    static const char* PERIOD_MILLISECS;
    static const char* FIFO;
    static const char* ROUND_ROBIN;
    static const char* HIGH_PRIORITY;
    static const char* PRIORITY_WITH_RESERVATION;
    static const char* PORT_BASE;
    static const char* DOMAIN_ID_GAIN;
    static const char* PARTICIPANT_ID_GAIN;
    static const char* OFFSETD0;
    static const char* OFFSETD1;
    static const char* OFFSETD2;
    static const char* OFFSETD3;
    static const char* RTPS_PDP_TYPE;
    static const char* _NONE;
    static const char* IGNORE_PARTICIPANT_FLAGS;
    static const char* _FILTER_DIFFERENT_HOST;
    static const char* _FILTER_DIFFERENT_PROCESS;
    static const char* _FILTER_SAME_PROCESS;
    static const char* WRITER_LVESS_PROTOCOL;
    static const char* DISCOVERY_SETTINGS;
    static const char* _EDP;
    static const char* DOMAIN_ID;
    static const char* LEASEDURATION;
    static const char* LEASE_ANNOUNCE;
    static const char* INITIAL_ANNOUNCEMENTS;
    static const char* AVOID_BUILTIN_MULTICAST;
    static const char* USE_CLIENT;
    static const char* USE_SERVER;
    static const char* SIMPLE_EDP;
    static const char* META_EXT_UNI_LOC_LIST;
    static const char* META_UNI_LOC_LIST;
    static const char* META_MULTI_LOC_LIST;
    static const char* INIT_PEERS_LIST;
    static const char* CLIENTANNOUNCEMENTPERIOD;
    static const char* SERVER_LIST;
    static const char* RSERVER;
    static const char* _SIMPLE;
    static const char* _STATIC;
    static const char* _CLIENT;
    static const char* _SUPER_CLIENT;
    static const char* _SERVER;
    static const char* _BACKUP;
    static const char* PUBWRITER_SUBREADER;
    static const char* PUBREADER_SUBWRITER;
    static const char* STATIC_ENDPOINT_XML;
    static const char* STATIC_ENDPOINT_XML_URI;
    static const char* STATIC_EDP_CONFIG;
    static const char* READER_HIST_MEM_POLICY;
    static const char* WRITER_HIST_MEM_POLICY;
    static const char* READER_PAYLOAD_SIZE;
    static const char* WRITER_PAYLOAD_SIZE;
    static const char* MUTATION_TRIES;
    static const char* ACCESS_SCOPE;
    static const char* ENABLED;
    static const char* DOMAIN_IDS;
    static const char* SHARED_DIR;
    static const char* MAX_DOMAINS;
    static const char* DEST_ORDER;
    static const char* IS_COMPATIBLE;
    static const char* DOMAIN_ID_LIST;
    // Endpoint parser
    static const char* STATICDISCOVERY;
    static const char* _READER;
    static const char* _WRITER;
    static const char* USER_ID;
    static const char* TOPIC_NAME;
    static const char* TOPIC_DATA_TYPE;
    static const char* TOPIC_KIND;
    static const char* RELIABILITY_QOS;
    static const char* UNICAST_LOCATOR;
    static const char* MULTICAST_LOCATOR;
    static const char* _RELIABLE_RELIABILITY_QOS;
    static const char* _BEST_EFFORT_RELIABILITY_QOS;
    static const char* DURABILITY_QOS;
    static const char* _PERSISTENT_DURABILITY_QOS;
    static const char* _TRANSIENT_DURABILITY_QOS;
    static const char* _TRANSIENT_LOCAL_DURABILITY_QOS;
    static const char* _VOLATILE_DURABILITY_QOS;
    static const char* OWNERSHIP_QOS;
    static const char* OWNERSHIP_KIND_NOT_PRESENT;
    static const char* _SHARED_OWNERSHIP_QOS;
    static const char* _EXCLUSIVE_OWNERSHIP_QOS;
    static const char* PARTITION_QOS;
    static const char* LIVELINESS_QOS;
    static const char* LIVELINESS_KIND_NOT_PRESENT;
    static const char* _AUTOMATIC_LIVELINESS_QOS;
    static const char* _MANUAL_BY_PARTICIPANT_LIVELINESS_QOS;
    static const char* _MANUAL_BY_TOPIC_LIVELINESS_QOS;
    static const char* LEASE_DURATION_MS;
    static const char* _INF;
    static const char* VBS_UNKNOWN_STRING;
    static const char* STRENGTH;
    static const char* DEADLINE_QOS;
    static const char* PERIOD_MS;

    // TYPES parser
    static const char* BOOLEAN;
    static const char* CHAR;
    static const char* WCHAR;
    static const char* TBYTE;
    static const char* OCTET;
    static const char* UINT8;
    static const char* INT8;
    static const char* SHORT;
    static const char* LONG;
    static const char* USHORT;
    static const char* ULONG;
    static const char* LONGLONG;
    static const char* ULONGLONG;
    static const char* FLOAT;
    static const char* DOUBLE;
    static const char* LONGDOUBLE;
    static const char* STRING;
    static const char* WSTRING;
    static const char* LITERAL;
    static const char* STRUCT;
    static const char* UNION;
    static const char* SEQUENCE;
    static const char* MAP;
    static const char* TYPEDEF;
    static const char* BITSET;
    static const char* BITMASK;
    static const char* ENUM;
    static const char* CASE;
    static const char* DEFAULT;
    static const char* DISCRIMINATOR;
    static const char* CASE_DISCRIMINATOR;
    static const char* ARRAY_DIMENSIONS;
    static const char* STR_MAXLENGTH;
    static const char* SEQ_MAXLENGTH;
    static const char* MAP_MAXLENGTH;
    static const char* MAP_KEY_TYPE;
    static const char* ENUMERATOR;
    static const char* NON_BASIC_TYPE;
    static const char* NON_BASIC_TYPE_NAME;
    static const char* KEY;
    static const char* EPKEY;
    static const char* ID;
    static const char* ANNO_OPTIONAL;
    static const char* EXTENSIBILITY;
    static const char* MEMBER;
    static const char* BITFIELD;
    static const char* BIT_VALUE;
    static const char* POSITION;
    static const char* BIT_BOUND;
    static const char* BASE_TYPE;

    // LOG
    static const char* LEVEL;
    static const char* USE_DEFAULT;
    static const char* CONSUMER;
    static const char* CLASS;
    static const char* MSG_TRACE_MASK;
    static const char* MSG_BRIEF_LIMIT;
    static const char* XML_ERROR;
    static const char* XML_WARNING;
    static const char* XML_INFO;
    static const char* XML_EVENT;
    static const char* DEBUG_;
    static const char* LATENCY_THRESHOLD;
    static const char* PERIOD_METRICS_INTERVAL;
    static const char* REPORT_WITH_PKTCOUNT;
    static const char* PKTLOSSRATE_THRESHOLD;
    static const char* THROUGHPUT_THRESHOLD;
    static const char* LOG_PERIOD;
    static const char* MSG_TOPIC_FILTER;
    static const char* MSG_BRIEF_MODE;

    // Allocation config
    static const char* INITIAL;
    static const char* MAXIMUM;
    static const char* INCREMENT;

    // TLS Config
    static const char* TLS;
    static const char* TLS_PASSWORD;
    static const char* TLS_OPTIONS;
    static const char* TLS_CERT_CHAIN_FILE;
    static const char* TLS_PRIVATE_KEY_FILE;
    static const char* TLS_TMP_DH_FILE;
    static const char* TLS_VERIFY_FILE;
    static const char* TLS_VERIFY_MODE;
    static const char* TLS_VERIFY_PATHS;
    static const char* TLS_DEFAULT_VERIFY_PATH;
    static const char* TLS_VERIFY_DEPTH;
    static const char* TLS_RSA_PRIVATE_KEY_FILE;
    static const char* TLS_HANDSHAKE_ROLE;
    static const char* TLS_SERVER_NAME;

    // TLS HandShake Role
    static const char* TLS_HANDSHAKE_ROLE_DEFAULT;
    static const char* TLS_HANDSHAKE_ROLE_CLIENT;
    static const char* TLS_HANDSHAKE_ROLE_SERVER;

    // TLS Verify Stuff
    static const char* TLS_VERIFY_PATH;
    static const char* TLS_VERIFY;

    // TLS Options
    static const char* TLS_OPTION;
    static const char* TLS_DEFAULT_WORKAROUNDS;
    static const char* TLS_NO_COMPRESSION;
    static const char* TLS_NO_SSLV2;
    static const char* TLS_NO_SSLV3;
    static const char* TLS_NO_TLSV1;
    static const char* TLS_NO_TLSV1_1;
    static const char* TLS_NO_TLSV1_2;
    static const char* TLS_NO_TLSV1_3;
    static const char* TLS_SINGLE_DH_USE;

    // TLS Verify Mode
    static const char* TLS_VERIFY_NONE;
    static const char* TLS_VERIFY_PEER;
    static const char* TLS_VERIFY_FAIL_IF_NO_PEER_CERT;
    static const char* TLS_VERIFY_CLIENT_ONCE;

    // Requester and Replier
    static const char* SERVICE_NAME;
    static const char* REQUEST_TYPE;
    static const char* REPLY_TYPE;
    static const char* REQUEST_TOPIC_NAME;
    static const char* REPLY_TOPIC_NAME;

    // E2E Protection
    static const char* E2E_PROTECTION;
    // E2E Profile04
    static const char* E2E_P04_DATA_ID;
    static const char* E2E_P04_MIN_DATA_LENGTH;
    static const char* E2E_P04_MAX_DATA_LENGTH;
    static const char* E2E_P04_MAX_DELTA_COUNTER;
    // E2E deadline
    static const char* E2E_DEADLINE_COUNTER;
    // E2E liveliness
    static const char* E2E_LIVELINESS_KIND;
    static const char* E2E_LIVELINESS_LEASE_DURATION;

    // compatible with DSF
    static const char* DSF_DSFPARTICIPANTID;
};

}  // namespace xmlparser

class constString {
 public:
    static const char* DSF_SHM_DRIVER_PATH;
};

class flowctlString {
 public:
    static const char* EDDS_FLOW_CONTROLLER_DEFAULT;
    static const char* EDDS_STATISTICS_FLOW_CONTROLLER_DEFAULT;
};
}  // namespace vbsutil

#endif  // INCLUDE_ERTPS_XMLPARSER_XMLPARSERCOMMON_H_
